From d763fcc1635f3dfc4af6da15a3f329cbe0e3e14e Mon Sep 17 00:00:00 2001 From: "vhanquez@gwig.uk.xensource.com" Date: Sat, 29 Jul 2006 14:05:59 +0100 Subject: [PATCH] Limit the number of opened transactions per connection to 5. Signed-off-by: Vincent Hanquez --- tools/xenstore/xenstored_transaction.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.c index f9d844e045..a3f2157256 100644 --- a/tools/xenstore/xenstored_transaction.c +++ b/tools/xenstore/xenstored_transaction.c @@ -125,6 +125,7 @@ void do_transaction_start(struct connection *conn, struct buffered_data *in) { struct transaction *trans, *exists; char id_str[20]; + int started; /* We don't support nested transactions. */ if (conn->transaction) { @@ -132,6 +133,15 @@ void do_transaction_start(struct connection *conn, struct buffered_data *in) return; } + started = 0; + list_for_each_entry(trans, &conn->transaction_list, list) + started++; + + if (started > 5) { + send_error(conn, ENOSPC); + return; + } + /* Attach transaction to input for autofree until it's complete */ trans = talloc(in, struct transaction); INIT_LIST_HEAD(&trans->changes); -- 2.30.2